package com.heima.user.controller.v1;

import com.aliyuncs.exceptions.ClientException;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.user.dtos.AppLoginDTO;
import com.heima.user.service.ApUserActivateService;
import com.heima.user.service.AppLoginService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Api(value = "app端用户激活",tags = "app端用户激活")
@RestController
@RequestMapping("/api/v1/activate")
public class ApUserActivateController {

    @Autowired
    ApUserActivateService apUserActivateService;


    @ApiOperation("发送激活链接到邮箱")
    @PostMapping("/sendCode")
    public ResponseResult sendCode(@RequestParam("email") String email){
        return apUserActivateService.sendCode(email);
    }

    @ApiOperation("激活")
    @PostMapping("/in")
    public ResponseResult login(@RequestParam String code) {
        return apUserActivateService.activate(code);
    }


}
